package com.dailyblue.java.spring.aop.advice;

import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

// 是一个通知 目前只实现了前置和后置
@Component
public class FirstAdvice implements AfterReturningAdvice, MethodBeforeAdvice {
    @Override
    public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
        System.out.println("我会在目标对象方法执行之后执行！");
    }
    @Override
    public void before(Method method, Object[] args, Object target) throws Throwable {
        System.out.println("我会在目标对象方法执行之前执行！");
    }
}
